﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Includes;

namespace AsyncroneModule
{
   /// <summary>
   /// Class used to check whether submitted vitaldata is plausible
   /// </summary>
   static public class PlausibilityCheck
   {
      // Define limit values, the border itself is considered invalid
      private const int lowerBorderBloodpressure =  71;
      private const int upperBorderBloodpressure = 129;
      private const int lowerBorderPulse  =  41;
      private const int upperBorderPulse  = 199;
      private const int lowerBorderWeight =  26;
      private const int upperBorderWeight = 299;
      
      /// <summary>
      /// Checks a Vital set for plausibility
      /// </summary>
      /// <param name="vita"> Set of values to be checked for plausibility </param>
      /// <returns> true if values are plausible, false otherwise </returns>
      public static bool isPlausible(Vitals vita)
      {
         if(  vita.blood  < lowerBorderBloodpressure || vita.blood  > upperBorderBloodpressure
           || vita.pulse  < lowerBorderPulse         || vita.pulse  > upperBorderPulse
           || vita.weight < lowerBorderWeight        || vita.weight > upperBorderWeight)
            return false;
         else
            return true;
      }
   }
}
